package com.ddd.demo.domain.dto;

/**
 * @author Administrator
 */
public class ListNode {

    public static Node getListNode1() {

        Node node1 = new Node();
        Node node2 = new Node();
        Node node3 = new Node();

        node1.setValue(8);
        node2.setValue(2);
        node3.setValue(3);

        node1.setNext(node2);
        node2.setNext(node3);

        return node1;
    }

    public static Node getListNode2() {

        Node node1 = new Node();
        Node node2 = new Node();
        Node node3 = new Node();

        node1.setValue(3);
        node2.setValue(7);
        node3.setValue(6);

        node1.setNext(node2);
        node2.setNext(node3);

        return node1;
    }


    public static void traver(Node node) {

        Node head = node;

        while (head != null) {
            System.out.println(head.getValue());
            head = head.getNext();
        }

    }

    public static void main(String[] args) {
        Node listNode1 = getListNode1();
        traver(listNode1);
    }

}
